﻿// -------------------------------------------------------------------------
//    @FileName         :    NFHeroAttrCalc.h
//    @Author           :    Gao.Yi
//    @Date             :    2025-09-30
//    @Email			:    445267987@qq.com
//    @Module           :    NFHeroAttrCalc
//    @Desc             :
//
// -------------------------------------------------------------------------

#pragma once

#include "NFComm/NFCore/NFPlatform.h"

struct E_Actor;
struct RoleCEData;
class HeroOne;

class NFIHeroAttrCalc
{
public:
    NFIHeroAttrCalc(HeroOne* pHero, NFIHeroAttrCalc* pPre, RoleCEData* pCEData = nullptr) : m_pHero(pHero), m_pPre(pPre), m_pCEData(pCEData)
    {
    }

    virtual ~NFIHeroAttrCalc()
    {
        if (m_pPre)
        {
            delete m_pPre;
        }
    }

    int Exec();

protected:
    virtual int DoExec() = 0;

    HeroOne* m_pHero;
    NFIHeroAttrCalc* m_pPre;
    RoleCEData* m_pCEData;
};

class CHeroBaseAttrCalc : public NFIHeroAttrCalc
{
public:
    CHeroBaseAttrCalc(HeroOne* pHero, NFIHeroAttrCalc* pPre, const E_Actor* pHeroDesc, int64_t llLevel, int64_t llExpSum, int iMapDescID = 0) : NFIHeroAttrCalc(pHero, pPre, nullptr), m_llLevel(llLevel), m_llExpSum(llExpSum), m_pHeroDesc(pHeroDesc), m_iMapDescID(iMapDescID)
    {
    }

protected:
    int DoExec() override;
    int64_t m_llLevel;
    int64_t m_llExpSum;
    const E_Actor* m_pHeroDesc;
    int m_iMapDescID;
};

class CHeroTotalAttrCalculator : public NFIHeroAttrCalc
{
public:
    CHeroTotalAttrCalculator(HeroOne* pHero, NFIHeroAttrCalc* pPre, const E_Actor* pHeroDesc, RoleCEData* pCEData = nullptr) : NFIHeroAttrCalc(pHero, pPre, pCEData), m_pHeroDesc(pHeroDesc)
    {
    }

protected:
    virtual int DoExec();
    const E_Actor* m_pHeroDesc;
};
